<h1>添加订单</h1>
<form name="userForm" novalidate>

    <div class="form-group">
        <label class="control-label db">添加产品:<span class="need">*</span></label>
        <a class="btn btn-primary btn-xs ml10" data-toggle="modal" data-target="#searchProductionModal"><span
                class="glyphicon glyphicon-plus"></span></a>
        <div class="mt5">
            <div ng-repeat="p in order.production track by $index" class="lg dib">
                <span>产品名称:{{p.name}}</span>
                <span>产品编码:{{p.code}}</span>
                <span>产品原价:{{p.cost}}</span>
                <span>优惠金额:{{p.cost - p.buyCost}}</span>
                <label class="mr2">购买数量:</label><input ng-change="calCost()" ng-model="p.num" type="number" value="1">
                <label class="mr2">购买价格:</label><input ng-change="calCost()" ng-model="p.buyCost" type="number">
                <a ng-click="remove(p, order.production)">
                <i class="remove ml2 cp glyphicon glyphicon-remove-sign glyphicon-white"></i></a>
            </div>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label db">用户:</label>
        <p class="dib form-control clearBorder">{{order.username}}</p>
        <a class="btn btn-primary btn-xs ml10" data-toggle="modal" data-target="#searchCustomerModal"><span
                class="glyphicon glyphicon-plus"></span></a>
    </div>


    
    
    <div class="form-group">
        <label class="control-label">收件人姓名<span class="need">*</span></label>
        <input type="text" class="form-control" name="stock" ng-model="order.receiverName" />
    </div>

    <div class="form-group">
        <label class="control-label">收件人地址</label>
        <input type="text" class="form-control" name="stock" ng-model="order.receiverAddress" />
    </div>


    <div class="form-group">
        <label class="control-label">收件人手机号码</label>
        <input type="text" class="form-control" name="stock" ng-model="order.receiverPhone" />
    </div>






    <div class="form-group">
        <label class="control-label">支付方式<span class="need">*</span></label>
        <div class="select">
            <select class="form-control" ng-model="order.payMethod">
                <option value="0">货到付款</option>
                <option value="1">支付宝网银支付</option>
                <option value="2">支付宝网页支付</option>
                <option value="3">支付宝wap支付</option>
                <option value="4">微信客户端支付</option>
                <option value="5">微信扫码支付</option>
                <option value="6">对公转账</option>
            </select>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label">状态<span class="need">*</span></label>
        <div class="select">
            <select class="form-control" ng-model="order.state">
                <option value="0">等待付款</option>
                <option value="1">收款中</option>
                <option value="2">收款失败</option>
                <option value="3">已付款</option>
                <option value="4">订单生效中</option>
                <option value="5">已完成</option>
                <option value="6">已退货</option>
                <option value="7">已退款</option>
            </select>
        </div>
    </div>

    <div class="mt20 fix">
        <button class="btn btn-primary" ng-click="save()">保存</button>
        <button class="btn btn-link" ng-click="reset()">重置</button>
    </div>

</form>




<div class="modal fade" id="searchProductionModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button"
                        class="close"
                        data-dismiss="modal"
                        aria-hidden="true">x</button>
                <h3 id="userMgrLabel">搜索产品</h3>
            </div>
            <div class="modal-body">

                <form name="userForm" class="form-horizontal" role="form">
                    <div class="form-group" >
                        <label class="col-sm-2 control-label">搜索按</label>
                        <label class="radio-inline">
                            <input type="radio" name="inlineRadioOptions" id="inlineRadio1" ng-model="searchProType" selected value="name"> 产品名或编码
                        </label>
                        <label class="radio-inline">
                            <input type="radio" name="inlineRadioOptions" id="inlineRadio2" ng-model="searchProType" value="tag"> 标签
                        </label>
                        <label class="radio-inline">
                            <input type="radio" name="inlineRadioOptions" id="inlineRadio3" ng-model="searchProType" value="summary">简介
                        </label>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">关键词</label>
                        <div class="col-sm-10">
                            <ng-autocomplete class="ltw" ng-model="editRelation"
                                             show-property="name"
                                             delay="300"
                                             theme="blue"
                                             init-text=""
                                             get-result="searchProduction(keyword)"
                                             placeholder="搜索产品">
                            </ng-autocomplete>
                            <a class="btn btn-primary btn-xs ml10" ng-click="addProduction(editRelation)"><span
                                    class="glyphicon glyphicon-plus"></span></a>
                        </div>
                    </div>




                </form>

            </div>
            <div class="modal-footer">
                <button class="btn" data-dismiss="modal" aria-hidden="true">取消</button>
                <button class="btn btn-primary"
                        data-dismiss="modal"
                        aria-hidden="true"
                        ng-click="saveRefund(refund)"
                >确定</button>
            </div>
        </div>
    </div>
</div>






<div class="modal fade" id="searchCustomerModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button"
                        class="close"
                        data-dismiss="modal"
                        aria-hidden="true">x</button>
                <h3 id="userMgrLabel">搜索用户</h3>
            </div>
            <div class="modal-body">

                <form name="userForm" class="form-horizontal" role="form">
                    <div class="form-group" >
                        <label class="col-sm-2 control-label">搜索按</label>
                        <label class="radio-inline">
                            <input type="radio" name="inlineRadioOptions" id="inlineRadio1" ng-model="searchCustomerType" selected value="username"> 用户名
                        </label>
                        <label class="radio-inline">
                            <input type="radio" name="inlineRadioOptions" id="inlineRadio2" ng-model="searchCustomerType" value="realName"> 昵称
                        </label>
                        <label class="radio-inline">
                            <input type="radio" name="inlineRadioOptions" id="inlineRadio3" ng-model="searchCustomerType" value="email">邮箱
                        </label>
                        <label class="radio-inline">
                            <input type="radio" name="inlineRadioOptions" id="inlineRadio3" ng-model="searchCustomerType" value="mobilePhoneNumber">手机
                        </label>
                        <label class="radio-inline">
                            <input type="radio" name="inlineRadioOptions" id="inlineRadio3" ng-model="searchCustomerType" value="address">地址
                        </label>
                        <label class="radio-inline">
                            <input type="radio" name="inlineRadioOptions" id="inlineRadio3" ng-model="searchCustomerType" value="group">分组
                        </label>

                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">关键词</label>
                        <div class="col-sm-10" ng-show="searchCustomerType!=='group'">
                            <ng-autocomplete class="ltw" ng-model="customer"
                                             show-property="username"
                                             delay="300"
                                             theme="blue"
                                             init-text=""
                                             handle-result="handleSeacherResult(result)"
                                             get-result="searchCustomer(keyword)"
                                             placeholder="搜索用户">
                            </ng-autocomplete>
                        </div>
                        <div class="col-sm-10" ng-show="searchCustomerType=='group'">
                            <select  class="form-control ltw" ng-change="searchCustomerByGroup(group)" ng-model="group">
                                <option ng-repeat="g in groups" value="{{g.objectId}}">{{g.name}}</option>
                            </select>
                            <div class="ng-autocomplete-holder" style="position: relative; z-index:1000">
                             <div class="ng-autocomplete-result ltw" ng-repeat="r in results " ng-click="handleSeacherResult(r)"  >
                                <span class="ng-autocomplete-result-title" ng-bind="r.username"></span>
                               </div>
                            </div>
                        </div>
                    </div>




                </form>

            </div>
            <div class="modal-footer">
                <button class="btn" data-dismiss="modal" aria-hidden="true">取消</button>
                <button class="btn btn-primary"
                        data-dismiss="modal"
                        aria-hidden="true"
                >确定</button>
            </div>
        </div>
    </div>
</div>





